﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.WModel
{
    public partial class WOITMUpdate : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.修改 };
            }
        }
        protected override string DWZRef
        {
            get { return "WOITMList"; }
        }

        #region
        /// <summary>
        /// 需要修改
        /// </summary>
        protected string ItemCode
        {
            get
            {
                return GetRequestValue<string>("ItemCode", "");
            }
        }

        private WOITMInfo _obj;
        protected WOITMInfo obj
        {
            get
            {
                if (_obj == null)
                    _obj = WOITMController.GetByItemCode(ItemCode);
                return _obj;
            }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "edit")
            {
                addmenu();
            }
        }

        protected void addmenu()
        {

            string U_KW = GetRequestValue<string>("U_KW", "");
            string U_GW = GetRequestValue<string>("U_GW", "");

            WOITMInfo objedit = Request.SerializableObject<WOITMInfo>();

            if (WOITMController.Update(objedit) > 0)
                SuccessAlertJson("修改成功");
            else
                ErrorJson("修改失败");
        }
    }
}